/**
 * Created by eddie on 2018/3/7.
 */
import _ from 'lodash'
import { Message } from 'element-ui'

export default {
    toggleMessageBar (message, type, option = {}) {
        if (_.isEmpty(type)) type = 'info'
        if (('|danger|error|').indexOf(type) > 0) {
            type = 'error'
        }

        let {duration, showClose, center} = option
        duration = duration || 3000
        showClose = showClose || false
        center = center || false

        Message({
            message,
            type,
            duration,
            showClose,
            center
        })
    }
}
